<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>{{.title}}</title>
  <link rel="stylesheet" href="https://g.ydbcdn.com/bootstrap/latest/css/bootstrap.css" />
  <script src="/static/js/jquery.min.js" type="text/javascript"></script>
  <script src="/static/js/tether.min.js" type="text/javascript"></script>
  <script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
</head>
<style>
  .left-bar {
    position: sticky;
    top: 50px;
    z-index: 1000;
    height: calc(100vh - 50px);
    border-right: 1px solid #dddddd;
  }
</style>

<body>
  <nav class="navbar navbar-light bg-faded">
    <a class="navbar-brand" href="#">后台管理</a>
    <a class="float-right" href="/logout">退出登录</a>
  </nav>
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-3 col-xl-2 left-bar">


        <ul class="list-group list-group-flush">
          <li class="list-group-item"><a href="/user/index">用户管理</a></li>


        </ul>

      </div>
      <div class="col-md-9 col-xl-8">
        <table class="table">
          <thead>
            <tr>
              <th>#</th>
              <th>用户名</th>
              <th>添加时间</th>
              <th>状态</th>
              <th>操作</td>
            </tr>
          </thead>
          <tbody>
            {{range .rows}}
            <tr>
              <th scope="row">{{.ID}}</th>
              <td>{{.Username}}</td>
              <td>{{.FormatDate}}</td>
              <td>{{ if .Status}} <span class="text-muted">删除</span>{{else}}<span class="text-success">正常</span> {{end}}
              </td>
              <td>
                <a class="text-danger del-link" href="javascript:;"   data-link="{{.DelLink}}">删除</span>
                  <a class="text-primary m-1" href="#">添加</span>

              </td>
            </tr>
            {{end}}
          </tbody>
        </table>
        <div class="page float-right">

    {{ if .p.HasPages }}
    <nav class="blog-pagination mb-5">
    
      {{ if .p.HasPrev }}
      <a class="btn btn-outline-primary" href="{{.p.Prev.URL}}" tabindex="-1" aria-disabled="true">上一页</a>
      {{ else }}
      <a class="btn btn-outline-secondary disabled" href="#" tabindex="-1" aria-disabled="true">上一页</a>
      {{ end }}
    
      {{ if .p.HasNext }}
      <a class="btn btn-outline-primary" href="{{.p.Next.URL}}" tabindex="-1" aria-disabled="true">下一页</a>
      {{ else }}
      <a class="btn btn-outline-secondary disabled" href="#" tabindex="-1" aria-disabled="true">下一页</a>
      {{ end }}
    
    </nav>
    {{ end }}

        </div>
          <button class="btn btn-default">{{.p.TotalCount}}</button>
      </div>

    </div>

  </div>

</body>

</html>


<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title" id="myModalLabel">添加用户测试</h4>
      </div>
      <div class="modal-body" style="padding: 2rem;">
        <form>
          <div class="form-group row">
            <label class="col-xs-2 col-form-label">用户名</label>
            <div class="col-xs-10">
              <input class="form-control" type="text" name="username">
            </div>
          </div>
          <div class="form-group row">
            <label class="col-xs-2 col-form-label">密码</label>
            <div class="col-xs-10">
              <input class="form-control" type="text" name="password">
            </div>
          </div>
        </form>

      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary" id="submit">保存</button>
      </div>
    </div>
  </div>
</div>



<script>
  $(function () {
    // $('#myModal').modal({show:true,backdrop:'static'});
    $('#submit').on('click', function () {
      let res = $('form').serializeArray();
      console.log(document.location.toString())
    });
    $('.del-link').on('click',function(){
        if(confirm("确认删除吗")){
            location.href = $(this).attr('data-link')
        }
    });
  });
</script>